import {
	defineStore
} from "pinia";
import {
	ref
} from "vue"
import {
	useSignalR
} from '../services/signalR.js'
export const useSignalRStore = defineStore(
	"signalRStore",
	() => {
		// const connection = ref < HubConnection > ()
		const sR = useSignalR()
		const start = () => sR.start()
		const stop = () => sR.stop()
		const on = sR.on
		const invoke = sR.invoke
		const off = sR.off
		return {
			start,
			stop,
			on,
			invoke,
			off
		};
	}, {
		unistorage: true, // 开启后对 state 的数据读写都将持久化
	},
);